﻿//-----------------------------------------------------------------------
// <copyright file="CreateOrEditTenantForm.cs" company="OOHM PROCESSAMENTO DE DADOS LTDA.">
//     Microsoft Public License (MS-PL) This license governs use of the accompanying
//     software. If you use the software, you accept this license. If you do not
//     accept the license, do not use the software. 1. Definitions The terms "reproduce,"
//     "reproduction," "derivative works," and "distribution" have the same meaning
//     here as under U.S. copyright law. A "contribution" is the original software,
//     or any additions or changes to the software. A "contributor" is any person
//     that distributes its contribution under this license. "Licensed patents"
//     are a contributor's patent claims that read directly on its contribution.
//     2. Grant of Rights (A) Copyright Grant- Subject to the terms of this license,
//     including the license conditions and limitations in section 3, each contributor
//     grants you a non-exclusive, worldwide, royalty-free copyright license to
//     reproduce its contribution, prepare derivative works of its contribution,
//     and distribute its contribution or any derivative works that you create.
//     (B) Patent Grant- Subject to the terms of this license, including the license
//     conditions and limitations in section 3, each contributor grants you a non-exclusive,
//     worldwide, royalty-free license under its licensed patents to make, have
//     made, use, sell, offer for sale, import, and/or otherwise dispose of its
//     contribution in the software or derivative works of the contribution in
//     the software. 3. Conditions and Limitations (A) No Trademark License- This
//     license does not grant you rights to use any contributors' name, logo, or
//     trademarks. (B) If you bring a patent claim against any contributor over
//     patents that you claim are infringed by the software, your patent license
//     from such contributor to the software ends automatically. (C) If you distribute
//     any portion of the software, you must retain all copyright, patent, trademark,
//     and attribution notices that are present in the software. (D) If you distribute
//     any portion of the software in source code form, you may do so only under
//     this license by including a complete copy of this license with your distribution.
//     If you distribute any portion of the software in compiled or object code
//     form, you may only do so under a license that complies with this license.
//     (E) The software is licensed "as-is." You bear the risk of using it. The
//     contributors give no express warranties, guarantees or conditions. You may
//     have additional consumer rights under your local laws which this license
//     cannot change. To the extent permitted under your local laws, the contributors
//     exclude the implied warranties of merchantability, fitness for a particular
// </copyright>
//-----------------------------------------------------------------------
namespace AbstractSaaSTemplate.UI.Web.Models.Tenant{    using System.ComponentModel.DataAnnotations;
    using AbstractSaaSTemplate.Application.Localization;
    using AbstractSaaSTemplate.Application.Mvc;
    using AbstractSaaSTemplate.Application.Validation;

    /// <summary>
    /// Formats the exchange of information in the cycle
    /// Controller > View > POST > Controller
    /// for the 'CreateOrEditTenant' action
    /// </summary>
    public class CreateOrEditTenantForm : ActionForm
    {
        /// <summary>
        /// Gets or sets the company name of the tenant.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [Display(ResourceType = typeof(Expressions), Name = "CompanyName")]
        public string CompanyName { get; set; }

        /// <summary>
        /// Gets or sets the display name of the tenant.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [Display(ResourceType = typeof(Expressions), Name = "DisplayName")]
        public string DisplayName { get; set; }

        /// <summary>
        /// Gets or sets the key or the url location for the tenant.
        /// This will be used to identify the tenant from the Url
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [Display(ResourceType = typeof(Expressions), Name = "KeyOrLocation")]
        public string KeyOrLocation { get; set; }

        /// <summary>
        /// Gets or sets the website of the company.
        /// </summary>
        [DataType(DataType.Url)]
        [RegularExpression(ExpressionsForRegex.Url, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsInvalid")]
        [Display(ResourceType = typeof(Expressions), Name = "Website")]
        public string Website { get; set; }

        /// <summary>
        /// Gets or sets the area code of the phone.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(3, MinimumLength = 1, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "PhoneAreaCode")]
        public string ContactPhoneAreaCode { get; set; }
        
        /// <summary>
        /// Gets or sets the number of the phone.
        /// </summary>
        [DataType(DataType.PhoneNumber)]
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(8, MinimumLength = 7, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [RegularExpression(ExpressionsForRegex.NumbersOnly, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsInvalid")]
        [Display(ResourceType = typeof(Expressions), Name = "PhoneNumber")]
        public string ContactPhoneNumber { get; set; }

        /// <summary>
        /// Gets or sets the area code of the phone.
        /// </summary>
        [StringLength(10, MinimumLength = 1, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "PhoneExtension")]
        public string ContactPhoneExtension { get; set; }

        /// <summary>
        /// Gets or sets the first name for the member.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [Display(ResourceType = typeof(Expressions), Name = "AdministratorFirstName")]
        public string AdministratorFirstName { get; set; }

        /// <summary>
        /// Gets or sets the surname for the administrator of the tenant.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [Display(ResourceType = typeof(Expressions), Name = "AdministratorLastName")]
        public string AdministratorLastName { get; set; }
        
        /// <summary>
        /// Gets or sets the e-mail address of the administrator of the tenant.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [DataType(DataType.EmailAddress)]
        [RegularExpression(ExpressionsForRegex.EmailAddress, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsInvalid")]
        [Display(ResourceType = typeof(Expressions), Name = "AdministratorEmailAddress")]
        public string AdministratorEmailAddress { get; set; }

        /// <summary>
        /// Gets or sets the billing 1st line of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(255, MinimumLength = 5, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "BillingAddressLine1")]
        public string BillingAddressLine1 { get; set; }

        /// <summary>
        /// Gets or sets the billing 2nd line of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(255, MinimumLength = 5, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "BillingAddressLine2")]
        public string BillingAddressLine2 { get; set; }

        /// <summary>
        /// Gets or sets the billing 3rd line of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(255, MinimumLength = 5, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "BillingAddressLine3")]
        public string BillingAddressLine3 { get; set; }

        /// <summary>
        /// Gets or sets the billing city of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(255, MinimumLength = 1, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "BillingAddressCity")]
        public string BillingAddressCity { get; set; }

        /// <summary>
        /// Gets or sets the billing state of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(255, MinimumLength = 1, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "BillingAddressState")]
        public string BillingAddressState { get; set; }

        /// <summary>
        /// Gets or sets the billing country code of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [Display(ResourceType = typeof(Expressions), Name = "BillingAddressCountryCode")]
        public string BillingAddressCountryCode { get; set; }

        /// <summary>
        /// Gets or sets the billing country code of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(15, MinimumLength = 5, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "BillingAddressPostalCode")]
        public string BillingAddressPostalCode { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the contact
        /// address will be a copy from the billing address.
        /// </summary>
        [Display(ResourceType = typeof(Expressions), Name = "ContactUsesTheSameAddressAsBilling")]
        public bool ContactUsesTheSameAddressAsBilling { get; set; }

        /// <summary>
        /// Gets or sets the contact 1st line of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(255, MinimumLength = 5, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "ContactAddressLine1")]
        public string ContactAddressLine1 { get; set; }

        /// <summary>
        /// Gets or sets the contact 2nd line of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(255, MinimumLength = 5, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "ContactAddressLine2")]
        public string ContactAddressLine2 { get; set; }

        /// <summary>
        /// Gets or sets the contact 3rd line of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(255, MinimumLength = 5, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "ContactAddressLine3")]
        public string ContactAddressLine3 { get; set; }

        /// <summary>
        /// Gets or sets the contact city of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(255, MinimumLength = 1, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "ContactAddressCity")]
        public string ContactAddressCity { get; set; }

        /// <summary>
        /// Gets or sets the contact state of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(255, MinimumLength = 1, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "ContactAddressState")]
        public string ContactAddressState { get; set; }

        /// <summary>
        /// Gets or sets the contact country code of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [Display(ResourceType = typeof(Expressions), Name = "ContactAddressCountryCode")]
        public string ContactAddressCountryCode { get; set; }

        /// <summary>
        /// Gets or sets the contact country code of the address.
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
        [StringLength(15, MinimumLength = 5, ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheLengthOfFieldXIsWrong")]
        [Display(ResourceType = typeof(Expressions), Name = "ContactAddressPostalCode")]
        public string ContactAddressPostalCode { get; set; }
    }
}


